
using System;

namespace GraphSpace
{
	
	public class Knoten
	{
		protected int id;
		
		public Knoten ()
		{
			this.id = 0;
		}
		
		public Knoten (int id)
		{
			this.id = id;
		}
		
		public virtual void init (int id)
		{
			this.id = id;
		}
		
		public override string ToString ()
		{
			return string.Format ("Knoten: Id={0}", Id);
		}
		
		// setzt die Attribute für Algorithmen auf ihre Standardwerte zurück
		public virtual void reset()
		{	
		}
		
		public virtual int Id
		{
			get{return this.id;}
		}
	}

	public class DijkstraKnoten : Knoten, IKey
	{
		public int HeapPos;
		public double distance;
		public Knoten predeseccor;
		public bool besucht;
		
		public int bucket;

		public double realdist;
		public int x;
		public int y;
		
		public DijkstraKnoten ()
		{
			distance = Double.MaxValue;
			predeseccor = null;
			besucht = false;
			HeapPos = 0;
			realdist = 0.0;
			x = 0;
			y = 0;
			bucket = 0;
		}
		
		public DijkstraKnoten (int id, int Distance, DijkstraKnoten Predeseccor, double Realdist, int X, int Y) :
			base(id)
		{
			distance = Distance;
			predeseccor = Predeseccor;
			besucht = false;
			HeapPos = 0;
			x = X;
			y = Y;
			realdist = Realdist;
		}

		public void setBucket(int bucket)
		{
			this.bucket = bucket;
		}
		
		public int getBucket ()
		{
			return this.bucket;
		}
		
		public double getKey()
		{
			return distance;
		}

		public void setKey(double Key)
		{
			distance = Key;
		}

		public int getHeapPos()
		{
			return HeapPos;
		}

		public void setHeapPos (int Pos)
		{
			HeapPos = Pos;
		}	
	}

    public class BiDijkstraKnoten : Knoten, IKey
    {
        public int HeapPos;
        public double distance;
        public Knoten predeseccor;
        public bool besucht;

        public int bucket;

        public double realdist;
        public int x;
        public int y;

        public bool foundBySearch;

        public BiDijkstraKnoten()
        {
            distance = Double.MaxValue;
            predeseccor = null;
            besucht = false;
            HeapPos = 0;
            realdist = 0.0;
            x = 0;
            y = 0;
            bucket = 0;
            foundBySearch = false;
        }

        public BiDijkstraKnoten(int id, int Distance, DijkstraKnoten Predeseccor, double Realdist, int X, int Y) :
            base(id)
        {
            distance = Distance;
            predeseccor = Predeseccor;
            besucht = false;
            HeapPos = 0;
            x = X;
            y = Y;
            realdist = Realdist;
            foundBySearch = false;
        }

        public void setBucket(int bucket)
        {
            this.bucket = bucket;
        }

        public int getBucket()
        {
            return this.bucket;
        }

        public double getKey()
        {
            return distance;
        }

        public void setKey(double Key)
        {
            distance = Key;
        }

        public int getHeapPos()
        {
            return HeapPos;
        }

        public void setHeapPos(int Pos)
        {
            HeapPos = Pos;
        }
    }
}
